var urlData = require('../../../../data/url.js');
Page({
  data: {
    commList: {},
    userId:1,
    role:6,
    showView: true,
    tishi:"暂时还没有上传任何的评语",
    imgUrl:"../../../../image/inform-list-image.jpg",
    onloadUrl: urlData.urlList.teachingManage.teacherComments.url
  },

  onLoad: function (e) {
    //读取login缓存
    wx.getStorage({
      key: "loginConf",
      success: function (res) {
        that.setData({
          userId: res.data.userId,
          role: res.data.userRole
        });
      }
    });
    //发请求
    var that = this;
    wx.request({
      url:this.data.onloadUrl,
      method: "get",
      data: {
        user_id: this.data.userId,
        role:this.data.role
  
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        if (res.data.code == 0) {
          // 判断后台返回的对象数组里面有没有东西，有则把提示去掉
          if(res.data.course_name!=null){
            that.listData( res);
          }
        }
      },
      fail: function (res) {
        console.log('刷list数据失败');
        that.setData({
          userId: res.data.userId,
          role: res.data.userRole
        });
      }
    })
  },

  /*刷新数据*/
  listData: function (res) {
    this.setData({
      commList: res.data.list,
      showView: false
    });
  }
})